<?php
/*
company:tiesh.com
project:common
function: 管理员权限控制

created by: Bach
created date: 2016-02-23
description:

modification v1.01
modified by:
description:
*/
namespace app\hongyanche\controller;
class Admin{
	function menu(){
		$menu = model('admin')->menu();
		return json($menu);
	}
	function chief_list(){
		return json(model('admin')->chiefList());
	}
	function search(){
		$tel = input('tel');
		return json(model('admin')->search($tel));
	}
	function get_list(){
		// if(cache('admin-list')){
			// return json(cache('admin-list'));
		// }
		$a = model('admin')->get_list();
		// cache('admin-list',$a);
		return json($a);
	}
	function list_option(){
		return json(model('admin')->list_option());
	}
	function rank(){
		return json(model('admin')->rank());
	}
	function add(){
		$class = input('class');
		$tel = input('tel');
		return json(model('admin')->add($tel,$class));
	}
	function remove(){
		$admin_id = input('admin_id');
		return json(model('admin')->remove($admin_id));
	}
	function ultimate(){
		$admin_id = input('admin_id');
		$ultimate = input('ultimate');
		return json(model('admin')->ultimate($admin_id,$ultimate));
	}
	function seal(){
		$admin_id = input('admin_id');
		$seal = input('seal');
		return json(model('admin')->seal($admin_id,$seal));
	}
	function set_name(){
		$user_id = input('user_id');
		$newname = input('newname');
		return json(model('user')->setName($user_id,$newname));
	}
}